let app = Gio.AppInfo.create_from_commandline(argv.join(' '), null,
Gio.AppInfoCreateFlags.SUPPORTS_STARTUP_NOTIFICATION);
- let context = global.create_app_launch_context();
+ let context = global.create_app_launch_context(0, -1);
app.launch([], context);
} catch(err) {
_handleSpawnError(argv[0], err);
try {
retval = app.launch(files,
- global.create_app_launch_context())
+ global.create_app_launch_context(0, -1))
} catch (e) {
log('Unable to launch the application ' + app.get_name()
+ ': ' + e.toString());
let cmd = 'empathy-accounts --select-account=' +
account.get_path_suffix();
let app_info = Gio.app_info_create_from_commandline(cmd, null, 0);
- app_info.launch([], global.create_app_launch_context());
+ app_info.launch([], global.create_app_launch_context(0, -1));
}));
this._enabledId = account.connect('notify::enabled',
let app = this._getCalendarApp();
if (app.get_id() == 'evolution.desktop')
app = Gio.DesktopAppInfo.new('evolution-calendar.desktop');
- app.launch([], global.create_app_launch_context());
+ app.launch([], global.create_app_launch_context(0, -1));
},
_onOpenClocksActivate: function() {
_onViewSource: function (actor) {
let extension = actor._extension;
let uri = extension.dir.get_uri();
- Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context());
+ Gio.app_info_launch_default_for_uri(uri, global.create_app_launch_context(0, -1));
this._lookingGlass.close();
},
_onWebPage: function (actor) {
let extension = actor._extension;
- Gio.app_info_launch_default_for_uri(extension.metadata.url, global.create_app_launch_context());
+ Gio.app_info_launch_default_for_uri(extension.metadata.url, global.create_app_launch_context(0, -1));
this._lookingGlass.close();
},
if (url.indexOf(':') == -1)
url = 'http://' + url;
- Gio.app_info_launch_default_for_uri(url, global.create_app_launch_context());
+ Gio.app_info_launch_default_for_uri(url, global.create_app_launch_context(0, -1));
return Clutter.EVENT_STOP;
}
return Clutter.EVENT_PROPAGATE;
// the provider is not compatible with the new version of the interface, launch
// the app itself but warn so we can catch the error in logs
log('Search provider ' + this.appInfo.get_id() + ' does not implement LaunchSearch');
- this.appInfo.launch([], global.create_app_launch_context());
+ this.appInfo.launch([], global.create_app_launch_context(0, -1));
}
});
let file = Gio.file_new_for_path(path);
try {
Gio.app_info_launch_default_for_uri(file.get_uri(),
- global.create_app_launch_context());
+ global.create_app_launch_context(0, -1));
} catch (e) {
// The exception from gjs contains an error string like:
// Error invoking Gio.app_info_launch_default_for_uri: No application
}
#endif
-static GAppLaunchContext *
-make_launch_context (guint timestamp,
- int workspace)
-{
- GdkAppLaunchContext *context;
- ShellGlobal *global;
- MetaScreen *screen;
- GdkDisplay *gdisplay;
-
- global = shell_global_get ();
- screen = shell_global_get_screen (global);
- gdisplay = gdk_screen_get_display (shell_global_get_gdk_screen (global));
-
- if (timestamp == 0)
- timestamp = shell_global_get_current_time (global);
-
- if (workspace < 0)
- workspace = meta_screen_get_active_workspace_index (screen);
-
- context = gdk_display_get_app_launch_context (gdisplay);
- gdk_app_launch_context_set_timestamp (context, timestamp);
- gdk_app_launch_context_set_desktop (context, workspace);
-
- return G_APP_LAUNCH_CONTEXT (context);
-}
-
/**
* shell_app_launch:
* @timestamp: Event timestamp, or 0 for current event timestamp
int workspace,
GError **error)
{
+ ShellGlobal *global;
GAppLaunchContext *context;
gboolean ret;
return TRUE;
}
- context = make_launch_context (timestamp, workspace),
+ global = shell_global_get ();
+ context = shell_global_create_app_launch_context (global, timestamp, workspace);
ret = g_desktop_app_info_launch_uris_as_manager (app->info, NULL,
context,
guint timestamp,
int workspace)
{
+ ShellGlobal *global;
GAppLaunchContext *context;
- context = make_launch_context (timestamp, workspace);
+ global = shell_global_get ();
+ context = shell_global_create_app_launch_context (global, timestamp, workspace);
g_desktop_app_info_launch_action (G_DESKTOP_APP_INFO (app->info),
action_name, context);
/**
* shell_global_create_app_launch_context:
* @global: A #ShellGlobal
+ * @timestamp: the timestamp for the launch (or 0 for current time)
+ * @workspace: a workspace index, or -1 to indicate the current one
*
* Create a #GAppLaunchContext set up with the correct timestamp, and
* targeted to activate on the current workspace.
* Return value: (transfer full): A new #GAppLaunchContext
*/
GAppLaunchContext *
-shell_global_create_app_launch_context (ShellGlobal *global)
+shell_global_create_app_launch_context (ShellGlobal *global,
+ int timestamp,
+ int workspace)
{
GdkAppLaunchContext *context;
context = gdk_display_get_app_launch_context (global->gdk_display);
- gdk_app_launch_context_set_timestamp (context, shell_global_get_current_time (global));
- // Make sure that the app is opened on the current workspace even if
- // the user switches before it starts
- gdk_app_launch_context_set_desktop (context, meta_screen_get_active_workspace_index (global->meta_screen));
+ if (timestamp == 0)
+ timestamp = shell_global_get_current_time (global);
+ gdk_app_launch_context_set_timestamp (context, timestamp);
+
+ if (workspace < 0)
+ workspace = meta_screen_get_active_workspace_index (global->meta_screen);
+ gdk_app_launch_context_set_desktop (context, workspace);
return (GAppLaunchContext *)context;
}
void shell_global_sync_pointer (ShellGlobal *global);
GAppLaunchContext *
- shell_global_create_app_launch_context (ShellGlobal *global);
+ shell_global_create_app_launch_context (ShellGlobal *global,
+ int timestamp,
+ int workspace);
void shell_global_play_theme_sound (ShellGlobal *global,
guint id,